/// 课程/视频章节
class CourseChapterModel {
  String? createdTime;
  String? modifyTime;
  String? createdBy;
  String? modifyBy;
  String? id;
  String? name;
  String? serverName;
  String? parentId;

  /// 叶子节点标志，true：最后一级，false：还有子章节
  bool? leaf;
  int? categoryId;
  int? sort;

  /// 视频数
  int? videoNum;
  String? remark;
  String? parent;
  List<String>? children;
  List<String>? videoIds;

  /// 免费标志，true：免费/已购买，false：未购买
  bool? free;

  /// 观看数量标志
  int? watchNum;
  int? level;
  String? opath;
  bool? top;
  String? topParentId;

  CourseChapterModel({
    this.createdTime,
    this.modifyTime,
    this.createdBy,
    this.modifyBy,
    this.id,
    this.name,
    this.serverName,
    this.parentId,
    this.leaf,
    this.categoryId,
    this.sort,
    this.videoNum,
    this.remark,
    this.parent,
    this.children,
    this.videoIds,
    this.free,
    this.watchNum,
    this.level,
    this.opath,
    this.top,
    this.topParentId,
  });

  CourseChapterModel.fromJson(Map<String, dynamic> json) {
    createdTime = json['createdTime'];
    modifyTime = json['modifyTime'];
    createdBy = json['createdBy'];
    modifyBy = json['modifyBy'];
    id = json['id'];
    name = json['name'];
    serverName = json['serverName'];
    parentId = json['parentId'];
    leaf = json['leaf'];
    categoryId = json['categoryId'];
    sort = json['sort'];
    videoNum = json['videoNum'];
    remark = json['remark'];
    parent = json['parent'];
    if (json["children"] != null) {
      children = json['children'].cast<String>();
    }
    if (json["videoIds"] != null) {
      videoIds = json['videoIds'].cast<String>();
    }
    free = json['free'];
    watchNum = json['watchNum'];
    level = json['level'];
    opath = json['opath'];
    top = json['top'];
    topParentId = json['topParentId'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['createdTime'] = createdTime;
    data['modifyTime'] = modifyTime;
    data['createdBy'] = createdBy;
    data['modifyBy'] = modifyBy;
    data['id'] = id;
    data['name'] = name;
    data['serverName'] = serverName;
    data['parentId'] = parentId;
    data['leaf'] = leaf;
    data['categoryId'] = categoryId;
    data['sort'] = sort;
    data['videoNum'] = videoNum;
    data['remark'] = remark;
    data['parent'] = parent;
    data['children'] = children;
    data['videoIds'] = videoIds;
    data['free'] = free;
    data['watchNum'] = watchNum;
    data['level'] = level;
    data['opath'] = opath;
    data['top'] = top;
    data['topParentId'] = topParentId;
    return data;
  }
}
